package loader

import (
	"gopkg.in/yaml.v2"
	"io/ioutil"
)

func Read(path string)([]byte, error){
	return ioutil.ReadFile(path)
}

func Yaml(path string, out interface{})([]byte, error){

	yamlFile, readErr := Read(path)

	if readErr != nil {
		return yamlFile, readErr
	}
	err := yaml.Unmarshal(yamlFile, out)

	if err != nil {
		return yamlFile, readErr
	}

	return yamlFile, err
}
